home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / compiler / Reloc.sml < prev    next >
Encoding:
Text File  |  1997-08-18  |  726 b   |  45 lines  |  [TEXT/R*ch]

  1. local
  2.   open Const Code_dec Buffcode;
  3. in
  4.  
  5. type reloc_table = (reloc_info * int) list;
  6.  
  7. val reloc_info = ref ([] : reloc_table);
  8.  
  9. fun reloc_reset () =
  10.   reloc_info := []
  11. ;
  12.  
  13. fun enter info =
  14.   reloc_info := (info, !out_position) :: !reloc_info
  15. ;
  16.  
  17. fun slot_for_literal sc =
  18.   (enter (Reloc_literal sc); out_short 0)
  19. ;
  20.  
  21. fun slot_for_get_global uid =
  22.   (enter (Reloc_getglobal uid); out_short 0)
  23. ;
  24.  
  25. fun slot_for_set_global uid =
  26.   (enter (Reloc_setglobal uid); out_short 0)
  27. ;
  28.  
  29. fun slot_for_tag id stamp =
  30.   (enter(Reloc_tag(id, stamp)); out 0)
  31. ;
  32.  
  33. fun slot_for_c_prim name =
  34.   (enter (Reloc_primitive name); out_short 0)
  35. ;
  36.  
  37. fun get_reloc_info () =
  38.   let val res = !reloc_info in
  39.     reloc_info := [];
  40.     List.rev res
  41.   end
  42. ;
  43.  
  44. end;
  45.